<?php defined( '_JEXEC' ) or die( 'Restricted access' ); ?><?php defined( '_SEXEC' ) or die( 'Restricted access' ); ?>
<?php
	if(!isset($_SESSION['username']) && !isset($_SESSION['usertype']))
		header("location: index.php");
?>
<?php	

if(isset($cno))
{
	echo '<div id="title">Search Result</div>';
	$sql="select tbl1.id, tbl2.companyname, date_format(tbl1.booking_date, '%d-%m-%Y') as `booking_date`, tbl1.cn_no, tbl3.destination, tbl1.document_id, tbl1.weight, tbl1.weight_unit, tbl1.cour_charge, tbl1.total_charge, tbl1.status from inventories as tbl1, companies as tbl2, destinations as tbl3 where tbl1.company_id = tbl2.id and tbl1.destination_id = tbl3.id and tbl1.cn_no = '$cno'";
	$result = mysql_query($sql);
	if(mysql_num_rows($result) > 0){
		$row = mysql_fetch_array($result);
		$id = $row['id'];
		$companyname = $row['companyname'];
		$booking_date = $row['booking_date'];
		$cn_no = $row['cn_no'];
		$destination = $row['destination'];
		$documentname = $slab_type_arr[$row['document_id']];
		$weight = $row['weight'];
		$weight_unit = $row['weight_unit'];
		$cour_charge = $row['cour_charge'];
		$total_charge = $row['total_charge'];
		$status = $row['status'];
	
		
		
		?>
		

		<table border="0" cellspacing="3" cellpadding="3" align="center">
			<tr>
				<td align=right>Company Name:</td>
				<td><?php echo $companyname?></td>
			</tr>
			<tr>
				<td align=right>Booking Date:</td>
				<td><?php echo $booking_date?></td>
			</tr>
			<tr>
				<td align=right>C/N No.:</td>
				<td><?php echo $cn_no?></td>
			</tr>
			<tr>
				<td align=right>Destination:</td>
				<td><?php echo $destination?></td>
			</tr>
			<tr>
				<td align=right>Document Type:</td>
				<td><?php echo $documentname?></td>
			</tr>
			<tr>
				<td align=right>Weight:</td>
				<td>
					<?php echo $weight.' '.$weight_unit_arr[$weight_unit]?>
				</td>
			</tr>
			<tr>
				<td align=right>Courier Charge:</td>
				<td><?php echo $cour_charge?></td>
			</tr>
			<tr>
				<td align=right>Total Charge:</td>
				<td><?php echo $total_charge?></td>
			</tr>
			<tr>
				<td align=right>Status:</td>
				<td><?php echo $status_arr[$status]?></td>
			</tr>
			<tr>
				<td colspan=2 align=center><a href="inventory.php?eid=<?php echo $id?>&submit=Update">Update</a> | <a href="inventory.php?eid=<?php echo $id?>&submit=Delete" onclick="javascript:return confirm('Are you sure you want to Delete?')">Delete</a></td>
			</tr>
			
		</table>
<?php
	} else {
?>	
		<table border="0" cellspacing="3" cellpadding="3" align="center">
			<tr>
				<td align=center>
					No Record found for this Courier No.
				</td>
			</tr>
		</table>	
<?php
	}
}		
?>	